﻿namespace Devonline.Entity;

/// <summary>
/// 员工
/// </summary>
[DisplayName("员工")]
public class StaffViewModel : StaffViewModel<string>, IViewModel, IEntitySet
{
    /// <summary>
    /// 员工个人信息
    /// </summary>
    public virtual PersonalViewModel? Personal { get; set; }
    /// <summary>
    /// 通用附件集合, NotMapped 用于记录实体对象上上传的附件
    /// </summary>
    public virtual ICollection<Attachment>? Attachments { get; set; }
}

/// <summary>
/// 员工
/// </summary>
/// <typeparam name="TKey">主键类型</typeparam>
[DisplayName("员工")]
public abstract class StaffViewModel<TKey> : ViewModel<TKey>, IViewModel<TKey>, IEntitySet<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 单位编号
    /// </summary>
    [DisplayName("单位编号"), Required, MaxLength(36), Excel]
    public virtual TKey OrganizationId { get; set; } = default!;
    /// <summary>
    /// 人员编号
    /// </summary>
    [DisplayName("人员编号"), Required, MaxLength(36), Excel]
    public virtual TKey PersonalId { get; set; } = default!;
    /// <summary>
    /// 工号
    /// </summary>
    [DisplayName("工号"), MaxLength(36), Excel]
    public virtual string Code { get; set; } = null!;
    /// <summary>
    /// 职位
    /// </summary>
    [DisplayName("职位"), MaxLength(128), Excel]
    public virtual string? Position { get; set; }
    /// <summary>
    /// 入职时间
    /// </summary>
    [DisplayName("入职时间"), Excel]
    public virtual DateTime? JoinTime { get; set; }
    /// <summary>
    /// 备注说明
    /// </summary>
    [DisplayName("备注说明"), MaxLength(255), Excel]
    public virtual string? Description { get; set; }
}